home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #2 / Amiga Plus CD - 2004 - No. 02.iso / AmiSoft / Misc / emu / Wzonka-Lad.lha / Wzonka-Lad / src / test / modem_recieve.s < prev    next >
Text File  |  1998-06-04  |  3KB  |  162 lines

  1.  
  2.         incdir    "binworld:includes/"
  3.  
  4.         include    "exec/memory.i"
  5.         include    "dos/dos.i"
  6.         include    "exec_lib.i"
  7.         include    "dos_lib.i"
  8.         
  9.         include    "devices/inputevent.i"
  10.         include    "devices/serial.i"
  11.         include    "exec/io.i"
  12.  
  13.  
  14.         section    alku,code
  15.  
  16.         move.l    execbase,exec_base
  17.  
  18.         move.l    exec_base,a6
  19.         lea    dos_name,a1
  20.         moveq.l    #39,d0
  21.         jsr    OpenLibrary(a6)
  22.         move.l    d0,dos_base
  23.         beq.w    quit
  24.  
  25.         moveq.l    #64,d0
  26.         move.l    #MEMF_PUBLIC!MEMF_CLEAR,d1
  27.         jsr    AllocVec(a6)
  28.         move.l    d0,io_buffer
  29.         beq.w    quit
  30.  
  31.         jsr    CreateMsgPort(a6)
  32.         move.l    d0,input_message_port
  33.         beq.w    quit
  34.  
  35.         move.l    input_message_port,a0
  36.         move.l    #IOEXTSER_SIZE,d0
  37.         jsr    CreateIORequest(a6)
  38.         move.l    d0,io_request
  39.         beq.w    quit
  40.  
  41.         lea    serial_device_name,a0
  42.         move.l    io_request,a1
  43.         moveq.l    #0,d0
  44.         moveq.l    #0,d1
  45.         jsr    OpenDevice(a6)
  46.         tst.l    d0
  47.         bne.w    quit
  48.  
  49.         move.b    #1,serial_device_status
  50.  
  51.         move.l    io_request,a1
  52.         move.l    #19200,IO_BAUD(a1)
  53.         move.w    #SDCMD_SETPARAMS,IO_COMMAND(a1)
  54.         jsr    DoIO(a6)
  55.         tst.l    d0
  56.         bne.w    quit
  57.  
  58.         moveq.l    #0,d7
  59.  
  60. io_connect_check:
  61.         cmp.w    #1000,d7
  62.         beq.w    io_connect_check_abort
  63.  
  64.         move.l    exec_base,a6
  65.         move.l    io_request,a1
  66.         move.l    #1,IO_LENGTH(a1)
  67.         move.l    io_buffer,IO_DATA(a1)
  68.         move.w    #SDCMD_QUERY,IO_COMMAND(a1)
  69.         jsr    DoIO(a6)
  70.         tst.l    d0
  71.         bne.w    quit
  72.  
  73.         move.l    dos_base,a6
  74.         move.l    #1,d1
  75.         jsr    Delay(a6)
  76.  
  77.         addq.w    #1,d7
  78.  
  79.         move.l    io_request,a0
  80.         move.w    IO_STATUS(a0),d0
  81.         btst    #5,d0
  82.         bne.s    io_connect_check
  83.  
  84.         move.l    exec_base,a6
  85.         move.l    io_request,a1
  86.         move.l    #13,IO_LENGTH(a1)
  87.         move.l    io_buffer,IO_DATA(a1)
  88.         move.w    #CMD_READ,IO_COMMAND(a1)
  89.         jsr    DoIO(a6)
  90.         tst.l    d0
  91.         bne.w    quit
  92.  
  93.         move.l    io_request,a1
  94.         jsr    WaitIO(a6)
  95.  
  96.         move.l    dos_base,a6
  97.         jsr    Output(a6)
  98.         move.l    d0,d1
  99.         move.l    io_buffer,d2
  100.         moveq.l    #13,d3
  101.         jsr    Write(a6)
  102.  
  103. io_connect_check_abort:
  104. quit:        move.l    exec_base,a6
  105.         move.l    io_request,d0
  106.         beq.s    no_io_request
  107.         move.l    d0,a1
  108.         jsr    _LVOAbortIO(a6)
  109.  
  110.         tst.b    serial_device_status
  111.         beq.s    no_close_device
  112.         move.l    io_request,a1
  113.         jsr    CloseDevice(a6)
  114.  
  115. no_close_device:move.l    io_request,a0
  116.         jsr    DeleteIORequest(a6)
  117.  
  118. no_io_request:    move.l    input_message_port,d0
  119.         beq.s    no_input_message_port
  120.         move.l    d0,a0
  121.         jsr    DeleteMsgPort(a6)
  122.  
  123. no_input_message_port:
  124.         move.l    io_buffer,d0
  125.         beq.s    no_io_buffer
  126.         move.l    d0,a1
  127.         jsr    FreeVec(a6)
  128.  
  129. no_io_buffer:    move.l    dos_base,d0
  130.         beq.s    no_dos_base
  131.         move.l    d0,a1
  132.         jsr    CloseLibrary(a6)
  133.  
  134. no_dos_base:    moveq.l    #0,d0
  135.         rts
  136.  
  137.  
  138.         section    loppu,data
  139.  
  140. exec_base:    dc.l    0
  141. dos_base:    dc.l    0
  142. dos_name:    dc.b    "dos.library",0
  143.         even
  144. serial_device_name:
  145.         dc.b    "serial.device",0
  146.         even
  147.  
  148. connect_data:    dc.b    "ATA",$d,0
  149.         even
  150.  
  151. io_request:    dc.l    0
  152. io_buffer:    dc.l    0
  153.  
  154. input_message_port:
  155.         dc.l    0
  156.  
  157. serial_device_status:
  158.         dc.b    0
  159.         even
  160.  
  161.         END
  162.